Eclipse Platform
Pre-release 3.0

org.eclipse.team.core.sync
Class RemoteContentsCacheEntry

java.lang.Object
  extended byorg.eclipse.team.core.sync.RemoteContentsCacheEntry

public class RemoteContentsCacheEntry
extends Object

This class provides the implementation for the ICacheEntry


Field Summary
static int DISPOSED
           
static int READY
           
static int UNINITIALIZED
           
 
Constructor Summary
RemoteContentsCacheEntry(RemoteContentsCache cache, String id, String filePath)
           
 
Method Summary
 void dispose()
           
 InputStream getContents()
           
protected  File getFile()
           
 String getId()
           
 long getLastAccessTimeStamp()
           
 long getSize()
           
 int getState()
           
 byte[] getSyncBytes()
           
protected  void registerHit()
          Registers a hit on this cache entry.
 void setContents(InputStream stream, IProgressMonitor monitor)
          Set the contents of for this cache entry.
 void setSyncBytes(byte[] bytes)
          Set the sync bytes associated with the cached remote contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNINITIALIZED

public static final int UNINITIALIZED
See Also:
Constant Field Values

READY

public static final int READY
See Also:
Constant Field Values

DISPOSED

public static final int DISPOSED
See Also:
Constant Field Values
Constructor Detail

RemoteContentsCacheEntry

public RemoteContentsCacheEntry(RemoteContentsCache cache,
                                String id,
                                String filePath)
Method Detail

getContents

public InputStream getContents()
                        throws TeamException
Throws:
TeamException

getFile

protected File getFile()

setContents

public void setContents(InputStream stream,
                        IProgressMonitor monitor)
                 throws TeamException
Set the contents of for this cache entry. This method supports concurrency by only allowing one cache entry to be written at a time. In the case of two concurrent writes to the same cache entry, the contents from the first write is used and the content from subsequent writes is ignored.

Parameters:
stream - an InputStream that provides the contents to be cached
monitor - a progress monitor
Throws:
TeamException - if the entry is DISPOSED or an I/O error occurres

getSyncBytes

public byte[] getSyncBytes()

setSyncBytes

public void setSyncBytes(byte[] bytes)
Set the sync bytes associated with the cached remote contents. This method is sychronized to ensure atomic setting of the bytes.

Parameters:
bytes -

getState

public int getState()

getSize

public long getSize()

getLastAccessTimeStamp

public long getLastAccessTimeStamp()

registerHit

protected void registerHit()
Registers a hit on this cache entry. This updates the last access timestamp. Thsi method is intended to only be invokded from inside this class or the cahce itself. Other clients should not use it.


dispose

public void dispose()

getId

public String getId()

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.